import {TimeStamp} from "../utils/utils";
import md5 from "md5";
export function Sign(appKey,secretKey,method,args) {
    args.app_key = appKey
    args.format = "json"
    args.method = method
    args.sign_method = "md5"
    args.timestamp =TimeStamp()
    args.v = "2.0"

    var sorted = Object.keys(args).sort();
    var basestring = secretKey;
    for (var i = 0, l = sorted.length; i < l; i++) {
      var k = sorted[i];
      basestring += k + args[k];
    }
    basestring +=secretKey;
    console.log(basestring)
    args.sign = md5(basestring).toUpperCase()
    return args
}
